package com.myfoon.model.entity;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name = "EVENT_PHOTO")
public class EventPhoto implements Serializable {
    private Long id;
    private Event event;
    private Photo photo;
    
    public EventPhoto() {
    }

    public void setId(Long id) {
        this.id = id;
    }
    
    @Id 
    @GeneratedValue(generator = "EventPhotoSequence", strategy = GenerationType.AUTO)
    @SequenceGenerator(name = "EventPhotoSequence", allocationSize = 1, sequenceName = "EVENT_PHOTO_SEQ_01")
    @Column(name = "ID")
    public Long getId() {
        return id;
    }

    public void setEvent(Event event) {
        this.event = event;
    }

    @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    @JoinColumn(name = "EVENT_ID")
    public Event getEvent() {
        return event;
    }

    public void setPhoto(Photo photo) {
        this.photo = photo;
    }

    @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    @JoinColumn(name = "PHOTO_ID")
    public Photo getPhoto() {
        return photo;
    }
}
